<html>

<head>
<meta http-equiv="Content-Type" content="text/html; charset=windows-1252">
<title>Update Student Details</title>
</head>

<body>
<?php include '../../top.html'; ?>
<?php include '../../authorization_check.php'; ?>
<?php include '../../checkVPCOnly.php'; ?>
<center>
<h1>Program Specific Details</h1>
<div>
<?php 
	session_start();
	$programCode = $_SESSION['programCode'];
	$programName = $_SESSION['programShortName'];
	$semesterID = $_SESSION['semesterID'];
?>

<?php
	require_once '../../commonutils/db/DBConnectionManager.php';

	if(isset($_POST['btnEventInsert']))
	{
		mt_srand((double)microtime()*1000000);
		$eventID = mt_rand(0, 1000000);
		$startDate = $_POST['txtEventStart3']."-".$_POST['txtEventStart2']."-".$_POST['txtEventStart1'];
		$endDate = $_POST['txtEventEnd3']."-".$_POST['txtEventEnd2']."-".$_POST['txtEventEnd1'];
		$description = $_POST['txtEventDescription'];

		$sqlquery = "insert into event values(".$eventID.",'".$startDate."','".$endDate."','".$description."',".$programCode.",".$semesterID.");"; 
		//echo $sqlquery;
		DBConnectionManager::query($sqlquery);
		echo "<center><h4>Event has been successfully added</h4></center>";		
	}

	
	if (isset($_POST['btnQuestionInsert']))
	{
		mt_srand((double)microtime()*1000000);
		$faqID = mt_rand(0, 1000000);
		$question = $_POST['txtQuestion'];
		$answer = $_POST['txtAnswer'];
		$sqlquery = "insert into faq values (".$faqID.",'".$question."','".$answer."',".$programCode.",".$semesterID.")";
		//echo $sqlquery;
		DBConnectionManager::query($sqlquery);
		echo "<center><h4>FAQ item has been successfully added</h4></center>";		
	}

?>

<div>
<form method="POST" action="AddProgramDetails.php">
<table border="1" width="56%" id="table1">
	<tr><td colspan="2" height="20"><center><h3>Add Event</h3></center></td></tr>
	<tr>
		<td width="178">Start Date (DD/MM/YYYY)</td>
		<td width="365"><input type="text" name="txtEventStart1" size="4">/<input type="text" name="txtEventStart2" size="4">/<input type="text" name="txtEventStart3" size="10"></td>
	</tr>
	<tr>
		<td width="178">End Date (DD/MM/YYYY)</td>
		<td width="365"><input type="text" name="txtEventEnd1" size="4">/<input type="text" name="txtEventEnd2" size="4">/<input type="text" name="txtEventEnd3" size="10"></td>
	</tr>
	<tr>
		<td width="178">Description</td>
		<td width="365"><textarea rows="3" name="txtEventDescription" cols="28"></textarea></td>
	</tr>
</table>
	<input type="submit" value="Insert" name="btnEventInsert">&nbsp;&nbsp;
	<input type="reset" value="Clear" name="btnEventClear">&nbsp;
	<input type="reset" value="Cancel" name="btnEventCancel">
</form>
</div>
<hr>
<div>
<form method="POST" action="AddProgramDetails.php">
<table border="1" width="56%" id="table1">
	<tr><td colspan="2" height="20"><center><h3>Add FAQ Item</h3></center></td></tr>
	<tr>
		<td width="112">Question</td>
		<td width="162"><input type="text" name="txtQuestion" size="40"></td>
	</tr>
	<tr>
		<td width="112">Answer</td>
		<td width="162"><input type="text" name="txtAnswer" size="40"></td>
	</tr>

</table>
	<input type="submit" value="Insert" name="btnQuestionInsert">&nbsp;&nbsp;
	<input type="reset" value="Clear" name="btnQuestionClear">&nbsp;
	<input type="reset" value="Cancel" name="btnQuestionCancel">
</form>
</div>
</center>

<?php include 'bottom.php' ?>

</body>

</html>